﻿using System.Web;
using Core.Library;

namespace Core.Library
{
    public class UrlHelpers
    {
        // group
        /************************************************************************************************************************************************************/
        public static string ListGroup
        {
            get { return "/Default.aspx?cId=2"; }            
        }

        public static string CreateGroup
        {
            get { return "/Default.aspx?cId=2&ucId=edit"; }                        
        }

        public static string EditGroup(int id)
        {
            return string.Format("/Default.aspx?cId=2&ucId=edit&gId={0}", id);
        }        

        public static string AdminGroupMenu(int id)
        {
            return string.Format("/Default.aspx?cId=2&ucId=agm&gId={0}", id);
        }

        // user
        /************************************************************************************************************************************************************/
        public static string ListUser
        {
            get { return "/Default.aspx?cId=3"; }
        }

        public static string CreateUser
        {
            get { return "/Default.aspx?cId=3&ucId=edit"; }
        }
        public static string EditUser(int id)
        {
            return string.Format("/Default.aspx?cId=3&ucId=edit&uId={0}", id);
        }

        public static string UserChangePassword
        {
            get { return "/Default.aspx?cId=5"; }
        }

        public static string UserInformation
        {
            get { return "/Default.aspx?cId=6"; }
        }

        public static string ChangePassword(int id)
        {
            return string.Format("/Default.aspx?cId=3&ucId=cpw&uId={0}", id);
        }

        public static string AdminGroupUser(int id)
        {
            return string.Format("/Default.aspx?cId=3&ucId=agu&uId={0}", id);
        }
        // admin menu
        /************************************************************************************************************************************************************/
        public static string ListMenu
        {
            get { return "/Default.aspx?cId=4"; }
        }

        public static string CreateMenu
        {
            get { return "/Default.aspx?cId=4&ucId=edit"; }
        }

        public static string EditMenu(int menuId)
        {
            return string.Format("/Default.aspx?cId=4&mId={0}&ucId=edit", menuId);
        }

        // category
        /************************************************************************************************************************************************************/
        public static string PaginationLinkCategory(string pageIndex)
        {
            return string.Format("/Default.aspx?cId=8&pi={0}", pageIndex);
        }

        public static string CreateCategory(int typeId)
        {
            return string.Format("/Default.aspx?cId=14&tId={0}", typeId);
        }

        public static string EditCategory(string typeId, string categoryId)
        {
            return string.Format("/Default.aspx?cId=14&tId={0}&catId={1}", typeId, categoryId);
        }

        public static string ListCategory
        {
            get { return "/Default.aspx?cId=8"; }
        }

        public static string ListCategoryProduct
        {
            get { return "/Default.aspx?cId=9"; }
        }

        public static string ListCategoryArticle
        {
            get { return "/Default.aspx?cId=10"; }
        }

        // article
        /************************************************************************************************************************************************************/
        public static string ListSearchArticle(int controlId, int categoryId, string keyword, int status, string pageIndex, int pageSize)
        {
            return string.Format("/Default.aspx?cId={0}&catId={1}&k={2}&status={3}&pi={4}&ps={5}", controlId, categoryId, keyword, status, pageIndex, pageSize);
        }

        public static string ListArticle
        {
            get { return "/Default.aspx?cId=19"; }
        }

        public static string CreateArticle(string returnUrl)
        {
            return string.Format("/Default.aspx?cId=20&ucId=15&rUrl={0}", returnUrl);
        }

        public static string CreateArticle()
        {
            return string.Format("/Default.aspx?cId=20&ucId=15");
        }

        public static string EditArticle(int articleId, string returnUrl)
        {
            return string.Format("/Default.aspx?cId=20&ucId=edit&aId={0}&rUrl={1}", articleId, returnUrl);
        }

        // product
        /************************************************************************************************************************************************************/
        public static string PaginationLinkProduct(string keyword, int categoryId, int status, int type, string pageIndex, int pageSize)
        {
            return string.Format("/Default.aspx?cId=12&k={0}&catId={1}&status={2}&tId={3}&pi={4}&ps={5}", keyword, categoryId, status, type, pageIndex, pageSize);
        }

        public static string ListProduct()
        {
            return "/Default.aspx?cId=12";
        }
        
        public static string ListProduct(string pageIndex, string pageSize)
        {
            return string.Format("/Default.aspx?cId=8&pi={0}&ps={1}", pageIndex, pageSize);
        }

        public static string CreateProduct()
        {
            return string.Format("/Default.aspx?cId=15&ucId=create");
        }

        public static string CreateProduct(string rUrl)
        {
            return string.Format("/Default.aspx?cId=15&ucId=create&rUrl={0}", rUrl);
        }

        public static string EditProduct(int productId, string returnUrl)
        {
            return string.Format("/Default.aspx?cId=15&ucId=edit&pId={0}&rUrl={1}", productId, returnUrl);
        }

        public static string ListProductSize(int productId)
        {
            return string.Format("/Default.aspx?cId=18&ucId=ps&pId={0}", productId);
        }

        public static string PaginationLinkProductSize(string productId, string storeId, string pageIndex, string pageSize)
        {
            return string.Format("/Default.aspx?cId=18&ucId=ps&pId={0}&sId={1}&pi={2}&ps={3}", productId, storeId, pageIndex, pageSize);
        }

        public static string ListProductPaginationByCategory(int categoryId, string categoryName, string pageIndex)
        {
            return string.Format("/san-pham/{0}/{1}/trang-{2}.htm", categoryId, UnicodeUtility.UnicodeToKoDauAndGach(categoryName).ToLower(), pageIndex);
        }
        
        public static string ListProductByCategory(int categoryId, string categoryName)
        {
            return string.Format("/san-pham/{0}/{1}.htm", categoryId, UnicodeUtility.UnicodeToKoDauAndGach(categoryName).ToLower());
        }

        public static string ProductDetail(string categoryName, int productId, string productName)
        {
            return string.Format("/san-pham/{0}/{1}/{2}.htm", 
                                    UnicodeUtility.UnicodeToKoDauAndGach(categoryName).ToLower(), 
                                    productId,
                                    UnicodeUtility.UnicodeToKoDauAndGach(productName).ToLower());
        }

        public static string ListPaginationRelatedProduct(int catId, int pId, int typeId, string pageIndex)
        {
            return string.Format("javascript:listRelatedProduct({0}, {1}, {2}, {3})", catId, pId, typeId, pageIndex);
        }

        public static string SearchProduct(string keyword)
        {
            return string.Format("/tim-kiem/{0}.htm", keyword);
        }

        public static string ListSearchProduct(string keyword, string pageIndex)
        {
            return string.Format("/tim-kiem/{0}/trang-{1}.htm", keyword, pageIndex);
        }

        // online
        /************************************************************************************************************************************************************/
        public static string ListOnline
        {
            get { return string.Format("/Default.aspx?cId=25"); }
        }
        public static string CreateOnline
        {
            get { return "/Default.aspx?cId=26&ucId=create"; } 
        }
        public static string EditOnline(int onlineId)
        {
            return string.Format("/Default.aspx?cId=26&ucId=edit&onlineId={0}", onlineId);
        }
        // order
        /************************************************************************************************************************************************************/
        public static string PaginationLinkOrder(string pageIndex, string pageSize)
        {
            return string.Format("/Default.aspx?cId=14&pi={0}&ps={1}", pageIndex, pageSize);
        }

        public static string ListOrder
        {
            get { return "/Default.aspx?cId=16"; }
        }

        public static string ListOrderDetailByOrder(int orderId)
        {
            return string.Format("/Default.aspx?cId=16&ucId=od&oId={0}", orderId);
        }

        public static string WriteOrder
        {
            get { return "/Default.aspx?cId=21"; }
        }

        public static string PerOrder(string customerId)
        {
            return string.Format("/Default.aspx?ucId=order&cId=8&cusId={0}", customerId);
        }

        public static string Order(string orderId)
        {
            return string.Format("/Default.aspx?ucId=order&cId=8&oId={0}", orderId);
        }

        // statistic
        /************************************************************************************************************************************************************/
        public static string GetStatistic
        {
            get { return "/Default.aspx?cId=32"; }
        }

        public static string ViewCart
        {
            get { return "/Default.aspx?cId=20"; }
        }

        // customer
        /************************************************************************************************************************************************************/
        public static string PaginationLinkCustomer(int typeId, string keyword, string pageIndex, string pageSize)
        {
            return string.Format("/Default.aspx?cId=11&tId={0}&k={1}&pi={2}&ps={3}", typeId, keyword, pageIndex, pageSize);
        }

        public static string CreateCustomer
        {
            get { return "/Default.aspx?cId=11&ucId=edit"; }
        }

        public static string EditCustomer(string customerId)
        {
            return string.Format("/Default.aspx?cId=11&ucId=edit&cusId={0}", customerId);
        }

        public static string ListCustomer
        {
            get { return "/Default.aspx?cId=11"; }
        }

        public static string Logout
        {
            get { return "/logout.htm"; }
        }
        
        // comment
        /************************************************************************************************************************************************************/
        public static string ListSearchComment(int controlId, int typeId, int status, string pageIndex, int pageSize)
        {
            return string.Format("/Default.aspx?cId={0}&tId={1}&status={2}&pi={3}&ps={4}", controlId, typeId, status, pageIndex, pageSize);
        }

        public static string ListPaginationByIdTypeId(int id, int typeId, string pageIndex)
        {
            return string.Format("javascript:listComment({0}, {1}, {2})", id, typeId, pageIndex);
        }

        public static string ListComment
        {
            get { return string.Format("/Default.aspx?cId=7"); } 
        }

        // news
        /************************************************************************************************************************************************************/        
        public static string ListArticleByCategory(int categoryId, string categoryName)
        {            
            return string.Format("/tin-tuc/{0}/{1}.htm", categoryId, UnicodeUtility.UnicodeToKoDauAndGach(categoryName).ToLower());
        }

        public static string ListArticleByCategoryPagination(int categoryId, string categoryName, string pageIndex)
        {
            return string.Format("/tin-tuc/{0}/{1}/trang-{2}.htm", categoryId, 
                                    UnicodeUtility.UnicodeToKoDauAndGach(categoryName).ToLower(), pageIndex);
        }

        public static string ArticleDetail(string categoryName, int articleId, string title)
        {
            return string.Format("/tin-tuc/{0}/{1}/{2}.htm", 
                                    UnicodeUtility.UnicodeToKoDauAndGach(categoryName).ToLower(), 
                                    articleId, 
                                    UnicodeUtility.UnicodeToKoDauAndGach(title).ToLower());
        }

        // static
        /************************************************************************************************************************************************************/
        public static string ArticleStatic(int typeId, int id, string title)
        {
            return string.Format("/thanh-toan/{0}/{1}/{2}.htm", typeId, id, UnicodeUtility.UnicodeToKoDauAndGach(title).ToLower());
        }

        // contact
        /************************************************************************************************************************************************************/
        public static string Contact
        {
            get { return "/lien-he.htm"; } 
        }

        // shopping cart
        /************************************************************************************************************************************************************/
        public static string ShoppingCart
        {
            get { return "/gio-hang.htm"; }
        }

        // login & register (Customer)
        /************************************************************************************************************************************************************/
        public static string LoginRegister
        {
            get { return "/khach-hang.htm"; }
        }

        public static string CustomerAccount
        {
            get { return "/tai-khoan.htm"; } 
        }

        public static string CustomerChangePassword
        {
            get { return "/doi-mat-khau.htm"; } 
        }

        public static string CustomerOrder
        {
            get { return "/don-hang.htm"; } 
        }

        public static string CustomerOrderDetail(int orderId)
        {
            return string.Format("/don-hang/{0}.htm", orderId);
        }

        // home
        /************************************************************************************************************************************************************/
        public static string Home
        {
            get { return "/trang-chu.htm"; }
        }

        
    }
}
